<html><head><title>ListIconGadget</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">ListIconGadget()</font></b></p>
<p><b>Syntax</b></p><blockquote>
Result = <font color="#3A3966"><b>ListIconGadget</b></font>(#Gadget, x, y, Width, Height, FirstColumnTitle$, FirstColumnWidth [, Flags])</blockquote>

</blockquote>
<b>Description</b><br><blockquote>

Creates a ListIcon gadget in the current GadgetList. 

</blockquote><p><b>Parameters</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#Gadget</i></td>
<td width="90%"> 
A number to identify the new gadget. <a href="../reference/purebasic_objects.html">#PB_Any</a> can 
be used to auto-generate this number. 

</td></tr>
<tr><td><i>x, y, Width, Height</i></td>
<td> 
The position and dimensions of the new gadget. 

</td></tr>
<tr><td><i>FirstColumnTitle$</i></td>
<td> 
The title for the first column in the gadget. The gadget is created with one initial column. 

</td></tr>
<tr><td><i>FirstColumnWidth</i></td>
<td> 
The width of the first column in the gadget. 

</td></tr>
<tr><td><i>Flags (optional)</i></td>
<td> 
Flags to modify the gadget behavior. It can be a combination of the following values: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_ListIcon_CheckBoxes</font>         : Display checkboxes in the first column.
  <font color="#924B72">#PB_ListIcon_ThreeState</font>         : The checkboxes can have an &quot;in between&quot; state.
  <font color="#924B72">#PB_ListIcon_MultiSelect</font>        : Enable multiple selection.
  <font color="#924B72">#PB_ListIcon_GridLines</font>          : Display separator lines between rows and columns (not supported on Mac OSX).
  <font color="#924B72">#PB_ListIcon_FullRowSelect</font>      : The selection covers the full row instead of the first column (Windows only). 
  <font color="#924B72">#PB_ListIcon_HeaderDragDrop</font>     : The order of columns can be changed using drag'n'drop.
  <font color="#924B72">#PB_ListIcon_AlwaysShowSelection</font>: The selection is still visible, even when the gadget is not activated (Windows only).
</font></pre>
The <font color="#924B72">#PB_ListIcon_ThreeState</font> flag can be used in combination with the 
<font color="#924B72">#PB_ListIcon_CheckBoxes</font> flag to get checkboxes that can have an &quot;on&quot;, &quot;off&quot; and &quot;in between&quot; state. 
The user can only select the &quot;on&quot; or &quot;off&quot; states. The &quot;in between&quot; state can be set programmatically using the <a href="setgadgetitemstate.html">SetGadgetItemState()</a> function. 

</td></tr>
</table>
</blockquote><p><b>Return value</b></p><blockquote>

Returns nonzero on success and zero on failure. If <font color="#924B72">#PB_Any</font> was used as the #Gadget parameter 
then the return-value is the auto-generated gadget number on success. 

</blockquote><p><b>Remarks</b></p><blockquote>

A 'mini help' can be added to this gadget using <a href="gadgettooltip.html">GadgetToolTip()</a>. 
<br>
<br>
The following functions can be used to act on the list content: 
<br>
<br>
- <a href="addgadgetcolumn.html">AddGadgetColumn()</a>: Add a column to the gadget. 
<br>
- <a href="removegadgetcolumn.html">RemoveGadgetColumn()</a>: Remove a column from the gadget. 
<br>
- <a href="addgadgetitem.html">AddGadgetItem()</a>: Add an item (with an optional image in the standard 16x16 icon size). 
<br>
- <a href="removegadgetitem.html">RemoveGadgetItem()</a>: Remove an item. 
<br>
- <a href="cleargadgetitems.html">ClearGadgetItems()</a>: Remove all the items. 
<br>
- <a href="countgadgetitems.html">CountGadgetItems()</a>: Returns the number of items currently in the #Gadget. 
<br>
<br>
- <a href="getgadgetitemcolor.html">GetGadgetItemColor()</a>: Returns front or backcolor of the item. 
<br>
- <a href="setgadgetitemcolor.html">SetGadgetItemColor()</a>: Changes front or backcolor of the item (backcolor not supported on MacOS X). 
<br>
- <a href="getgadgetitemdata.html">GetGadgetItemData()</a>: Returns the value that was stored with item. 
<br>
- <a href="setgadgetitemdata.html">SetGadgetItemData()</a>: Stores a value with the item. 
<br>
- <a href="getgadgetitemstate.html">GetGadgetItemState()</a>: Returns the current state of the specified item. 
<br>
- <a href="setgadgetitemstate.html">SetGadgetItemState()</a>: Changes the current state of the specified item. 
<br>
- <a href="getgadgetitemtext.html">GetGadgetItemText()</a>: Returns the current text of the specified item. (or column header, if item = -1) 
<br>
- <a href="setgadgetitemtext.html">SetGadgetItemText()</a>: Changes the current text of the specified item. (or column header, if item = -1). 
Like with <a href="addgadgetitem.html">AddGadgetItem()</a>, it is possible to set the text for several columns at once, with the <a href="../string/chr.html">Chr(10)</a> separator. 
<br>
- <a href="setgadgetitemimage.html">SetGadgetItemImage()</a>: Changes the current image of the specified item. 
<br>
- <a href="getgadgetstate.html">GetGadgetState()</a>: Returns the first selected item or -1 if there is no item selected. 
<br>
- <a href="setgadgetstate.html">SetGadgetState()</a>: Change the selected item (all other selected items will be deselected). If -1 is specified, no more item will be selected. 
<br>
- <a href="getgadgetattribute.html">GetGadgetAttribute()</a> / <a href="setgadgetattribute.html">SetGadgetAttribute()</a>: With the following attribute: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_ListIcon_DisplayMode</font> : Changes the display of the gadget. Can be one of the following constants (Windows only):
    <font color="#924B72">#PB_ListIcon_LargeIcon</font>: Large icon mode
    <font color="#924B72">#PB_ListIcon_SmallIcon</font>: Small icon mode
    <font color="#924B72">#PB_ListIcon_List</font>     : List icon mode
    <font color="#924B72">#PB_ListIcon_Report</font>   : Report mode (columns, default mode)
</font></pre>
<br>
- <a href="getgadgetitemattribute.html">GetGadgetItemAttribute()</a> / <a href="setgadgetitemattribute.html">SetGadgetItemAttribute()</a>: With the following attribute: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_ListIcon_ColumnWidth</font> : Returns/Changes the width of the given 'Column'. The 'Item' parameter is ignored.
</font></pre>


This gadget supports the <a href="setgadgetcolor.html">SetGadgetColor()</a> and <a href="getgadgetcolor.html">GetGadgetColor()</a> functions with 
the following values as 'ColorType': 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_Gadget_FrontColor</font>: Textcolor
  <font color="#924B72">#PB_Gadget_BackColor</font> : Backgroundcolor
  <font color="#924B72">#PB_Gadget_LineColor</font> : Color for the gridlines if the <font color="#924B72">#PB_ListIcon_GridLines</font> flag is used.
</font></pre>

The following events are supported through <a href="../window/eventtype.html">EventType()</a>: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_EventType_LeftClick</font>: left click on an item, or a checkbox was checked/unchecked
  <font color="#924B72">#PB_EventType_LeftDoubleClick</font>
  <font color="#924B72">#PB_EventType_RightClick</font>
  <font color="#924B72">#PB_EventType_RightDoubleClick</font>
  <font color="#924B72">#PB_EventType_Change</font>: the current item changed
  <font color="#924B72">#PB_EventType_DragStart</font>: the user tried to start a Drag &amp; Drop operation.
</font></pre>
After a <font color="#924B72">#PB_EventType_DragStart</font> event, the <a href="../dragdrop/index.html">Drag & Drop library</a> can be used to start 
a Drag &amp; Drop operation. 

</blockquote><p><b>Example</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2"> <b><font color="#3A3966">If</font></b> <font color="#3A3966">OpenWindow</font>(0, 100, 100, 300, 100, &quot;ListIcon Example&quot;, <font color="#924B72">#PB_Window_SystemMenu</font> | <font color="#924B72">#PB_Window_ScreenCentered</font>)
<font color="#3A3966">   ListIconGadget</font>(0, 5, 5, 290, 90, &quot;Name&quot;, 100, <font color="#924B72">#PB_ListIcon_FullRowSelect</font> | <font color="#924B72">#PB_ListIcon_AlwaysShowSelection</font>)
<font color="#3A3966">   AddGadgetColumn</font>(0, 1, &quot;Address&quot;, 250)
<font color="#3A3966">   AddGadgetItem</font>(0, -1, &quot;Harry Rannit&quot;+<font color="#3A3966">Chr</font>(10)+&quot;12 Parliament Way, Battle Street, By the Bay&quot;)
<font color="#3A3966">   AddGadgetItem</font>(0, -1, &quot;Ginger Brokeit&quot;+<font color="#3A3966">Chr</font>(10)+&quot;130 PureBasic Road, BigTown, CodeCity&quot;)
   <b><font color="#3A3966">Repeat</font></b>
     Event =<font color="#3A3966"> WaitWindowEvent</font>()
   <b><font color="#3A3966">Until</font></b> Event = <font color="#924B72">#PB_Event_CloseWindow</font>
 <b><font color="#3A3966">EndIf</font></b>
</font></pre>

</blockquote><p><b>Example</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <font color="#3A3966">; Shows possible flags of ListIconGadget in action...</font>
  <b><font color="#3A3966">If</font></b> <font color="#3A3966">OpenWindow</font>(0, 0, 0, 640, 300, &quot;ListIconGadgets&quot;, <font color="#924B72">#PB_Window_SystemMenu</font> | <font color="#924B72">#PB_Window_ScreenCentered</font>)
    <font color="#3A3966">; left column</font>
<font color="#3A3966">    TextGadget    </font>(6,  10,  10, 300, 20, &quot;ListIcon Standard&quot;, <font color="#924B72">#PB_Text_Center</font>)
<font color="#3A3966">    ListIconGadget</font>(0,  10,  25, 300, 70, &quot;Column 1&quot;, 100)
<font color="#3A3966">    TextGadget    </font>(7,  10, 105, 300, 20, &quot;ListIcon with Checkbox&quot;, <font color="#924B72">#PB_Text_Center</font>)
<font color="#3A3966">    ListIconGadget</font>(1,  10, 120, 300, 70, &quot;Column 1&quot;, 100, <font color="#924B72">#PB_ListIcon_CheckBoxes</font>)  <font color="#3A3966">; ListIcon with checkbox</font>
<font color="#3A3966">    TextGadget    </font>(8,  10, 200, 300, 20, &quot;ListIcon with Multi-Selection&quot;, <font color="#924B72">#PB_Text_Center</font>)
<font color="#3A3966">    ListIconGadget</font>(2,  10, 215, 300, 70, &quot;Column 1&quot;, 100, <font color="#924B72">#PB_ListIcon_MultiSelect</font>) <font color="#3A3966">; ListIcon with multi-selection</font>
    <font color="#3A3966">; right column</font>
<font color="#3A3966">    TextGadget    </font>(9, 330,  10, 300, 20, &quot;ListIcon with separator lines&quot;,<font color="#924B72">#PB_Text_Center</font>)
<font color="#3A3966">    ListIconGadget</font>(3, 330,  25, 300, 70, &quot;Column 1&quot;, 100, <font color="#924B72">#PB_ListIcon_GridLines</font>)
<font color="#3A3966">    TextGadget   </font>(10, 330, 105, 300, 20, &quot;ListIcon with FullRowSelect and AlwaysShowSelection&quot;,<font color="#924B72">#PB_Text_Center</font>)
<font color="#3A3966">    ListIconGadget</font>(4, 330, 120, 300, 70, &quot;Column 1&quot;, 100, <font color="#924B72">#PB_ListIcon_FullRowSelect</font> | <font color="#924B72">#PB_ListIcon_AlwaysShowSelection</font>)
<font color="#3A3966">    TextGadget   </font>(11, 330, 200, 300, 20, &quot;ListIcon Standard with large icons&quot;,<font color="#924B72">#PB_Text_Center</font>)
<font color="#3A3966">    ListIconGadget</font>(5, 330, 220, 300, 65, &quot;&quot;, 200,<font color="#924B72">#PB_ListIcon_GridLines</font>)
    <b><font color="#3A3966">For</font></b> a = 0 <b><font color="#3A3966">To</font></b> 4            <font color="#3A3966">; add columns to each of the first 5 listicons</font>
      <b><font color="#3A3966">For</font></b> b = 2 <b><font color="#3A3966">To</font></b> 4          <font color="#3A3966">; add 3 more columns to each listicon</font>
<font color="#3A3966">        AddGadgetColumn</font>(a, b, &quot;Column &quot; +<font color="#3A3966"> Str</font>(b), 65)
      <b><font color="#3A3966">Next</font></b>
      <b><font color="#3A3966">For</font></b> b = 0 <b><font color="#3A3966">To</font></b> 2          <font color="#3A3966">; add 4 items to each line of the listicons</font>
<font color="#3A3966">        AddGadgetItem</font>(a, b, &quot;Item 1&quot;+<font color="#3A3966">Chr</font>(10)+&quot;Item 2&quot;+<font color="#3A3966">Chr</font>(10)+&quot;Item 3&quot;+<font color="#3A3966">Chr</font>(10)+&quot;Item 4&quot;)
      <b><font color="#3A3966">Next</font></b>
    <b><font color="#3A3966">Next</font></b>
    <font color="#3A3966">; Here we change the ListIcon display to large icons and show an image</font>
    <b><font color="#3A3966">If</font></b> <font color="#3A3966">LoadImage</font>(0, <font color="#924B72">#PB_Compiler_Home</font>+&quot;Examples\Sources\Data\File.bmp&quot;)     <font color="#3A3966">; change path/filename to your own 32x32 pixel image</font>
<font color="#3A3966">      SetGadgetAttribute</font>(5, <font color="#924B72">#PB_ListIcon_DisplayMode</font>, <font color="#924B72">#PB_ListIcon_LargeIcon</font>)
<font color="#3A3966">      AddGadgetItem</font>(5, 1, &quot;Picture 1&quot;,<font color="#3A3966"> ImageID</font>(0))
<font color="#3A3966">      AddGadgetItem</font>(5, 2, &quot;Picture 2&quot;,<font color="#3A3966"> ImageID</font>(0))
    <b><font color="#3A3966">EndIf</font></b>
    <b><font color="#3A3966">Repeat</font></b> : <b><font color="#3A3966">Until</font></b> <font color="#3A3966">WaitWindowEvent</font>() = <font color="#924B72">#PB_Event_CloseWindow</font>
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>


<p><img src="../HelpPictures/listicongadget.png"></p>

</blockquote><p><b>See Also</b></p><blockquote>

<a href="addgadgetcolumn.html">AddGadgetColumn()</a>, <a href="removegadgetcolumn.html">RemoveGadgetColumn()</a>, <a href="addgadgetitem.html">AddGadgetItem()</a>, <a href="removegadgetitem.html">RemoveGadgetItem()</a>, <a href="cleargadgetitems.html">ClearGadgetItems()</a>, <a href="countgadgetitems.html">CountGadgetItems()</a>, 
<a href="getgadgetstate.html">GetGadgetState()</a>, <a href="setgadgetstate.html">SetGadgetState()</a>, <a href="getgadgetattribute.html">GetGadgetAttribute()</a>, <a href="setgadgetattribute.html">SetGadgetAttribute()</a>, <a href="getgadgetitemtext.html">GetGadgetItemText()</a>, <a href="setgadgetitemtext.html">SetGadgetItemText()</a>, <a href="setgadgetitemimage.html">SetGadgetItemImage()</a>, 
<a href="getgadgetitemstate.html">GetGadgetItemState()</a>, <a href="setgadgetitemstate.html">SetGadgetItemState()</a>, <a href="getgadgetitemdata.html">GetGadgetItemData()</a>, <a href="setgadgetitemdata.html">SetGadgetItemData()</a>, <a href="getgadgetitemattribute.html">GetGadgetItemAttribute()</a>, <a href="setgadgetitemattribute.html">SetGadgetItemAttribute()</a>, 
<a href="getgadgetcolor.html">GetGadgetColor()</a>, <a href="setgadgetcolor.html">SetGadgetColor()</a>, <a href="getgadgetitemcolor.html">GetGadgetItemColor()</a>, <a href="setgadgetitemcolor.html">SetGadgetItemColor()</a>, <a href="explorerlistgadget.html">ExplorerListGadget()</a>, <a href="listviewgadget.html">ListViewGadget()</a> 

</Blockquote><p><b>Supported OS </b><Blockquote>All</Blockquote></p><center><- <a href=isgadget.html>IsGadget()</a> - <a href="index.html">Gadget Index</a> - <a href="listviewgadget.html">ListViewGadget()</a> -><br><br>

</body></html>